<%--
 *  File:   contactProdPopWindow.jsp
 *  Date		  Author		  Changes
 *  2009-10-24	  awesomewang		  Created
 *
 *  Copyright (C) 2000 - 2005 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>
<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java"%>
<%@ page import="java.util.*"%>
<%@ page import="org.apache.log4j.Category"%>

<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/oval-tag.tld" prefix="oval"%>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom"%>
<%
	//init param
  	String privilegeCode = "All";
    String strModuleName = "COM";
    String strTableName = "v_zylhospitalcompetitionpro";
  	String contextPath = request.getContextPath();
%>
<%@ include file="/inc/PageDefault.inc"%>
<%@ include file="/inc/LocationDefault.inc"%>
<html>
<head>
<title>contactProdPopWindow</title>
<PageFlow:CheckPageFlow pageName="p_zylhospitalprod"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath %>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="../../../js/Calendar.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/ScriptLib.js"></script>
<%@ include file="/inc/NewCalendar.inc" %>
<%@ include file="/inc/SummaryDivision.inc"%>
<%
  Vector details = (Vector)pageContext.getAttribute("details");
  if(details == null) details = new Vector();
%>
<%
	HashMap Cuserinfo = (HashMap)session.getAttribute("userinfo");
   	if (Cuserinfo==null){
   		Cuserinfo = new HashMap();
   	}  
   	String strDisplayFlag="";
   	if(request.getParameter("displayflag")!=null)
   	{
   	  strDisplayFlag=request.getParameter("displayflag");
   	}
   	String isview=(String)request.getParameter("isview");
  	if(isview == null)
  	{
  		isview = "";
  	}
  	
%>
<script language="JavaScript">
function page_add(){
    //if(!checkALLElems(document.getElementById("newdetail"))) return;  
    if(!checkForm(document.cform)) return;
    cform.actionname.value = "add";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}
function page_delete()
{
    if(isNullChecked(cform.deleteids))
    {
        alert('<%= message.getMessageDesc("MUST_SELECT_ONE_RECORD_TO_DEL") %>');
        return;
    }
    if(!confirm('<%= message.getMessageDesc("ARE_YOU_SURE_DEL") %>')) return;
    cform.actionname.value = "delete";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}
function page_save()
{
    if(!checkALLElems(document.getElementById("olddetail"))) return;
    cform.actionname.value = "save";
    cform.target = "_self";
    isRunning = true;
    cform.submit();
}

function page_setproduct(id,umcode,prodcode,prodname){
		document.cform.prodid.value=id;
		document.cform.brandcode.value=prodname;
}

function page_selectProd() {
		var status = "height=400, width=500,top=100,left=100,toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no";
		var url = "<%=contextPath%>/phap/phap.datp/masterdata/kdm/ProductSelect.jsp?o_thread=" + Math.random();
		if (typeof popwindow != 'undefined') popwindow.close();
		popwindow = window.open(url, "newwindow1", status);
	}
</script>
<body style="overflow: auto;">
<form name="cform" method="post" action="<%=contextPath%>/Dispatcher" >
  <input type="hidden" name="pagename" value="p_zylhospitalprod">
  <input type="hidden" name="actionname">
  <input type="hidden" name="schema" value="v_zylhospitaldeptprodate">
  <input type="hidden" name="hospitalid" value="<%=request.getParameter("hospitalid") %>">	
  <input type="hidden" name="numrows" value="<%= details.size() %>">
  <input type="hidden" name="isview" value="<%=request.getParameter("isview") %>">
<table width="100%" cellspacing="0" border="0" cellpadding="0">
	<tr>
		<td>
		<table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0">
		<tr class="deepblue-left"> 
          	<td width="5%" class="deepblue-left">&nbsp;</td>
          	<td width="30%" class="title_center">&nbsp;<%= label.getLabelName("L_ProdName") %></td>
          	<td width="30%" class="title_center">&nbsp;<%= label.getLabelName("L_Comments") %></td>
        </tr>
	    <span id="olddetail" >
	    <%
	    int idx=0;
	    %>
       	<logic:iterate id="prodgroup" collection="<%= details %>">
       	<tr>
         	<td width="30">
				<custom:checkbox property="hospitalcompetitionproid" name="prodgroup" changedName="deleteids" styleClass="normalradio" />
         	</td>
	        <td>&nbsp;<custom:write name="prodgroup" property="brandcode" nbsp="true" /><custom:write name="prodgroup" property="spec" nbsp="true" /></td>
	        <td>&nbsp;<custom:write name="prodgroup" property="comments" nbsp="true" /></td>
    	</tr>
       	<tr>
         	<td style="display:none"><custom:hidden name="onerow" property="hospitalcompetitionproid" colIndex="<%= new Integer(idx) %>"/></td>
        </tr>
        <%
        idx++;
        %>
        </logic:iterate>
		</span>
	    <%
	    if(!(strDisplayFlag).equals("view")){
		%>
		<span id="newdetail" >
       	<tr >
       	<td>&nbsp;</td>
	    <td class="td_left" width="24%"><custom:text property="brandcode" readonly="true" size="22" />
	     <a onclick="javascript:page_selectProd();"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0" /></a> 
	     <custom:hidden property="prodid" command="notnull" label="L_Product" name="newdetail"/>
	     <custom:hidden property="prodcode" />
	    </td>
	    <td class="td_left" width="24%"><custom:text property="comments" size="50" name="newdetail"/>
	    </td>
       	</tr>
		</span>
          <%@ include file="/inc/SummaryAction.inc" %>
		</table>
		<table width="100%" cellspacing="0" cellpadding="0">
			<tr>
				<td class="summary_top"></td>
			</tr>
			<tr>
				<td class="td_center"><a onclick="javascript:page_add();"><custom:button type="1" label="L_Add" imgsrc="finish.gif" border="0" style="width:60" /></a>
				<a onclick="javascript:page_delete();"><custom:button type="1" label="L_Delete" imgsrc="finish.gif" border="0" style="width:60" /></a></td>
			</tr>
		</table>
		<%} %>
		</td>
	</tr>
</table>
</form>
</body>
</html>